//#pragma code
/******************************************************************************
 Project:    buzzer2000
 Modul:      display.c
 Descr:      

 Date:       14.07.2012
 Autor:      Rainer
 Notes:      -
 ******************************************************************************/
#include "display.h"

void DISPLAY_vSetBuzzerDisplayMode(ui uiDisplayMode, ui uiBuzzerId) {
	switch (uiDisplayMode) {
	case DISPLAY_DISABLED: {
		DISPLAY_vSetDisplayDisabled(uiBuzzerId);
		break;
	}
	case DISPLAY_ACTIVE: {
		DISPLAY_vSetDisplayActive(uiBuzzerId);
		break;
	}
	case DISPLAY_READY: {
		DISPLAY_vSetDisplayReady(uiBuzzerId);
		break;
	}
	default:
		break;
	}
}

void DISPLAY_vSetDisplayDisabled(ui uiBuzzerId) {
	switch (uiBuzzerId) {
	case 0: {
		// LEDs aus
		PORTA &= ~(1 << LED_GREEN);
		PORTA &= ~(1 << LED_RED);
		break;
	}
	case 1: {
		// LEDs aus
		PORTB &= ~(1 << LED_GREEN);
		PORTB &= ~(1 << LED_RED);
		break;
	}
	case 2: {
		// LEDs aus
		PORTC &= ~(1 << LED_GREEN);
		PORTC &= ~(1 << LED_RED);
		break;
	}
	case 3: {
		// LEDs aus
		PORTD &= ~(1 << LED_GREEN);
		PORTD &= ~(1 << LED_RED);
		break;
	}
	default:
		break;
	}
}

void DISPLAY_vSetDisplayReady(ui uiBuzzerId) {
	switch (uiBuzzerId) {
	case 0: {
		// LED_GREEN an
		PORTA |= (1 << LED_GREEN);
		// LED_RED aus
		PORTA &= ~(1 << LED_RED);
		break;
	}
	case 1: {
		// LED_GREEN an
		PORTB |= (1 << LED_GREEN);
		// LED_RED aus
		PORTB &= ~(1 << LED_RED);
		break;
	}
	case 2: {
		// LED_GREEN an
		PORTC |= (1 << LED_GREEN);
		// LED_RED aus
		PORTC &= ~(1 << LED_RED);
		break;
	}
	case 3: {
		// LED_GREEN an
		PORTD |= (1 << LED_GREEN);
		// LED_RED aus
		PORTD &= ~(1 << LED_RED);
		break;
	}
	}
}

void DISPLAY_vSetDisplayActive(ui uiBuzzerId) {
	switch (uiBuzzerId) {
	case 0: {
		// LED_GREEN an
		PORTA |= (1 << LED_RED);
		// LED_RED aus
		PORTA &= ~(1 << LED_GREEN);
		break;
	}
	case 1: {
		// LED_GREEN an
		PORTB |= (1 << LED_RED);
		// LED_RED aus
		PORTB &= ~(1 << LED_GREEN);
		break;
	}
	case 2: {
		// LED_GREEN an
		PORTC |= (1 << LED_RED);
		// LED_RED aus
		PORTC &= ~(1 << LED_GREEN);
		break;
	}
	case 3: {
		// LED_GREEN an
		PORTD |= (1 << LED_RED);
		// LED_RED aus
		PORTD &= ~(1 << LED_GREEN);
		break;
	}
	}
}
